package com.zw.mes.module.tecsummary.controller;

import com.zw.mes.base.BaseController;
import com.zw.mes.common.JsonResult;
import com.zw.mes.entity.technology.Result;
import com.zw.mes.module.cost.model.DictCommon;
import com.zw.mes.module.cost.service.DictCommonService;
import com.zw.mes.module.technology.service.PurchasedService;
import com.zw.mes.module.tecsummary.service.SummaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

import static com.zw.mes.constant.Constant.GROUP_SPECTYPE;
import static com.zw.mes.constant.Constant.SUMMARY_INTO;

/**
 * @author mayongfeng
 * @version 1.0.0
 * @ClassName Summary.java
 * @Description TODO
 * @createTime 2021年03月29日 09:46:00
 */
@Controller
@SuppressWarnings("all")
@RequestMapping("/summary")
public class SummaryController extends BaseController {
    @Autowired
    private SummaryService summaryService;
    @Autowired
    private DictCommonService dictCommonService;

    /**
     * @Author mayongfeng
     * @Date 14:15 2021/1/29
     * @Description 页面跳转到外购件计划分配
     *
     **/
    @GetMapping
    public String listPage(Model model, Result result){
        model.addAttribute("special", dictCommonService.findDictByGroupName(GROUP_SPECTYPE));
        return "technology/summary/selectAll";
    }

    @PostMapping("/into")
    @ResponseBody
    private JsonResult into(){
        List<DictCommon> dictCommons = dictCommonService.findDictByGroupName(SUMMARY_INTO);
        return jsonResult(dictCommons);
    }


}
